<?php
/**
 * 失效卡券
 */
require_once('common.php');
$unavailable_url = 'https://api.weixin.qq.com/card/code/unavailable?access_token='; //失效卡券的url

$access_token = get_access_token();
$postData = array(
    'card_id' => 'pEZwf1DduS5dwTDyQXyqOp7B5xS4',
    'code'    => '017741511268',
    'reason'  => '取消原因：测试'
);

$isunavailable = unavailablecard($unavailable_url.$access_token, $postData);
echo '<pre>';
print_r($isunavailable);exit;

//失效卡券
function unavailablecard($url, $data){
    $result = jsonpostJson($url, $data, true);
    return $result;
}